package bamboo.drawingkid.controls;

import javax.microedition.lcdui.Graphics;

import bamboo.drawingkid.Main;
import bamboo.drawingkid.views.DrawingView;
import bamboo.drawingkid.views.components.FileSaveDialog;

public class DrawingViewController extends DrawingView {

	private final Main		midlet;
	private static DrawingViewController self;
    private FileSaveDialog	dlgSaveFile;
    
	public static DrawingViewController getInstance()
	{
		if(self == null) {
			self = new DrawingViewController();
		}
		return self;
	}

	private DrawingViewController(){
		super();
		midlet = Main.getInstance();
    	dlgSaveFile = new FileSaveDialog(this);
	}

	protected void render(Graphics g) {
		super.render(g);
		dlgSaveFile.render(g);
	}
	
	protected void pointerPressed(int aX, int aY) {
		// TODO Auto-generated method stub
		super.pointerPressed(aX, aY);
		if(!isDrawingAllowed() && dlgSaveFile.isVisible()) {
			dlgSaveFile.pointerPressed(aX, aY);
		}
	}

	protected void pointerReleased(int aX, int aY) {
		// TODO Auto-generated method stub
		if(!isDrawingAllowed() && dlgSaveFile.isVisible()) {
			dlgSaveFile.pointerUnpressed(aX, aY);
		}
		super.pointerReleased(aX, aY);
	}

	public void showOpenImageView() {
		// TODO Auto-generated method stub
		
	}

	public void showBrushSizeView() {
		// TODO Auto-generated method stub
		
	}

	public void showColorsView() {
		// TODO Auto-generated method stub
		
	}

	public void showSaveProgress() {
		DrawingViewController.getInstance().setDrawingAllowed(false);
		dlgSaveFile.show();
	}
	
	public void showTemplate() {
		// TODO Auto-generated method stub
		
	}

}
